package com.ychong.library.view.imagebanner

import android.content.Context
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import com.bumptech.glide.Glide
import com.ychong.library.view.YCHZoomImageView
import com.ychong.library.utils.ToastUtils

class DefaultImageAdapter(val context:Context,var dataList:MutableList<String>):IImageAdapter {
    override fun isEmpty(): Boolean {
        return dataList.isEmpty()
    }

    override fun getView(position: Int): View {
        val imageView = ImageView(context)
        //val lp = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT)
        //imageView.layoutParams = lp
        Glide.with(context).load(dataList[position]).into(imageView)
        imageView.setOnClickListener {
            ToastUtils.showText(
                context,
                "Now is $position"
            )
        }
        return imageView
    }

    override fun getCount(): Int {
        return dataList.size
    }
}